package com.code.aicodemother.controller;

import com.code.aicodemother.common.BaseResponse;
import com.code.aicodemother.common.ResultUtils;
import com.code.aicodemother.service.CaptchaService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 验证码控制器
 *
 * @author ys
 */
@RestController
@RequestMapping("/captcha")
public class CaptchaController {

    @Resource
    private CaptchaService captchaService;

    /**
     * 生成验证码
     *
     * @return 验证码结果
     */
    @GetMapping("/generate")
    public BaseResponse<CaptchaService.CaptchaResult> generateCaptcha() {
        CaptchaService.CaptchaResult result = captchaService.generateCaptcha();
        return ResultUtils.success(result);
    }
}
